package com.example.demo.datasources;

import com.example.demo.entity.User;
import com.example.demo.service.DataSourceTestService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
public class TestDataSourceContorller {

    @Resource
    DataSourceTestService dataSourceTestService;

    @RequestMapping("testDataSource")
    public Map<String, Object> test() {
        User t = dataSourceTestService.queryUser(1L);
        User t2 = dataSourceTestService.queryUser2(1L);
        User t3 = dataSourceTestService.queryUser3(1L);


        Map<String, Object> map = new HashMap<>();
        map.put("t.name", t.getName());
        map.put("t2.name", t2.getName());
        map.put("t3.name", t3.getName());
        return map;
    }

}
